Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support bevy 0.15 #85

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ActuallyHappening
Copy link
Contributor

These changes support bevy 0.15.
I couldn't find any bugs except a random #[cfg(feature = "webgl")] that doesn't seem to actually exist, which I just commented out and don't think will make any difference (as it couldn't have been enabled before without manually passing --cfg="feature='webgl'" on the command line.

Could this get a crates-io release soon? I'm trying to port over bevy-editor-pls: jakobhellermann/bevy_editor_pls#118

@ActuallyHappening
Copy link
Contributor Author

I'm explicitely not porting over the examples/bevy because it depends on multiple other projects that have not yet been updated to bevy 0.15, notably bevy_infinite_grid, and I don't want the example to hold this back from a crates-io release

@ethereumdegen
Copy link

ethereumdegen commented Dec 13, 2024

when i use your fork i still get the panic

thread '<unnamed>' panicked at /home/andy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-23.0.1/src/api/buffer.rs:684:9:
slice offset 0 is out of range for buffer of size 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at /home/andy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.15.0/src/diagnostic/mod.rs:158:9:
PassSpanScope::end was never called
stack backtrace:

and it might NOT be from this crate but im thinking it is -- bc it only happens when this xform gizmo state is being changed

@ActuallyHappening
Copy link
Contributor Author

ActuallyHappening commented Dec 13, 2024

Interesting, I've used this project in bevy_editor_pls fine with no panics at all. I'm running pop!OS linux, maybe that is why your getting the panic and I'm not?
My fork is doing everything I want it to, I've patched this crate at the top level so I don't mind if you want to open your own seperate PR that doesn't crash instead of this one
I don't really have the time to debug this as I don't observe the same panic sorry

@onkoe
Copy link

onkoe commented Dec 17, 2024

@ActuallyHappening Unfortunately, I just encountered the same error in your crate. I think something may be changed mistakenly.

Please see the following logs:

Barrett@DESKTOP-H0N0G0O MINGW64 ~/Documents/projects/recall_destruction_demo (main)
$ cargo run
   Compiling recall_destruction_demo v0.1.0 (C:\Users\Barrett\Documents\projects\recall_destruction_demo)
    Finished `dev` profile [optimized + debuginfo] target(s) in 23.73s
     Running `target\debug\recall_destruction_demo.exe`
2024-12-17T00:15:19.106499Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon RX 6750 XT", vendor: 4098, device: 29663, device_type: DiscreteGpu, driver: "AMD proprietary driver", driver_info: "24.8.1 (AMD proprietary shader compiler)", backend: Vulkan }
2024-12-17T00:15:19.257700Z  INFO bevy_winit::system: Creating new window "Recall Destruction Demo" (0v1#4294967296)
2024-12-17T00:15:19.287296Z  INFO bevy_editor_pls_default_windows::cameras: Spawning editor cameras
2024-12-17T00:15:19.289239Z  INFO symphonia_core::probe: found the format marker [4f, 67, 67, 53] @ 0+2 bytes.
2024-12-17T00:15:19.289482Z  INFO symphonia_format_ogg::demuxer: starting new physical stream
2024-12-17T00:15:19.289640Z  INFO symphonia_format_ogg::demuxer: selected vorbis mapper for stream with serial=0x438c
2024-12-17T00:15:19.290034Z  INFO symphonia_core::probe: found the format marker [52, 49, 46, 46] @ 0+2 bytes.
2024-12-17T00:15:19.292347Z  INFO symphonia_core::probe: found the format marker [52, 49, 46, 46] @ 0+2 bytes.
2024-12-17T00:15:19.292457Z  INFO symphonia_format_riff::common: ignoring unknown chunk: tag=bext, len=602.
2024-12-17T00:15:19.292561Z  INFO symphonia_format_riff::common: ignoring unknown chunk: tag=minf, len=16.
2024-12-17T00:15:19.292637Z  INFO symphonia_format_riff::common: ignoring unknown chunk: tag=elm1, len=214.
2024-12-17T00:15:19.292710Z  INFO symphonia_format_riff::common: ignoring unknown chunk: tag=FLLR, len=92.
2024-12-17T00:15:19.294058Z  INFO symphonia_core::probe: found the format marker [52, 49, 46, 46] @ 0+2 bytes.
2024-12-17T00:15:19.550599Z  WARN bevy_gltf::loader: Unknown vertex attribute TEXCOORD_2
2024-12-17T00:15:19.589982Z  WARN bevy_gltf::loader: Unknown vertex attribute TEXCOORD_2
thread '<unnamed>' panicked at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-23.0.1\src\api\buffer.rs:684:9:
slice offset 0 is out of range for buffer of size 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\diagnostic\mod.rs:158:9:
PassSpanScope::end was never called
stack backtrace:
   0:     0x7ffce1d654b1 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ffce1d654b1 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffce1d654b1 - std::sys::backtrace::_print_fmt
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\sys\backtrace.rs:66
   3:     0x7ffce1d654b1 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\sys\backtrace.rs:39
   4:     0x7ffce1d9c2da - core::fmt::rt::Argument::fmt
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/core\src\fmt\rt.rs:177
   5:     0x7ffce1d9c2da - core::fmt::write
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/core\src\fmt\mod.rs:1190
   6:     0x7ffce1d5b677 - std::io::Write::write_fmt<std::sys::pal::windows::stdio::Stderr>
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\io\mod.rs:1839
   7:     0x7ffce1d652f5 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\sys\backtrace.rs:42
   8:     0x7ffce1d681c3 - std::panicking::default_hook::closure$1
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\panicking.rs:268
   9:     0x7ffce1d67fa2 - std::panicking::default_hook
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\panicking.rs:295
  10:     0x7ffce1d688c3 - std::panicking::rust_panic_with_hook
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\panicking.rs:801
  11:     0x7ffce1d68712 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\panicking.rs:667
  12:     0x7ffce1d65f6f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\sys\backtrace.rs:170
  13:     0x7ffce1d6834e - std::panicking::begin_panic_handler
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\panicking.rs:665
  14:     0x7ffce1dc8111 - core::panicking::panic_fmt
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/core\src\panicking.rs:75
  15:     0x7ffca023d13b - bevy_render::diagnostic::impl$4::drop<enum2$<core::option::Option<alloc::sync::Arc<bevy_render::diagnostic::internal::DiagnosticsRecorder,alloc::alloc::Global> > >,bevy_render::render_phase::draw_state::TrackedRenderPass>
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\diagnostic\mod.rs:158
  16:     0x7ffca03d3fd1 - bevy_core_pipeline::core_3d::main_transparent_pass_3d_node::impl$0::run
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_core_pipeline-0.15.0\src\core_3d\main_transparent_pass_3d_node.rs:79
  17:     0x7ffd11d7f730 - _CxxFrameHandler3
  18:     0x7ffd11d73a86 - is_exception_typeof
  19:     0x7ffd11d7ec04 - _C_specific_handler
  20:     0x7ffd11d72c94 - is_exception_typeof
  21:     0x7ffd11d7f541 - _CxxFrameHandler3
  22:     0x7ffd1759293f - _chkstk
  23:     0x7ffd17520939 - RtlUnwindEx
  24:     0x7ffd11d7f0ca - _C_specific_handler
  25:     0x7ffd11d718e5 - is_exception_typeof
  26:     0x7ffd11d71d00 - is_exception_typeof
  27:     0x7ffd11d72d90 - is_exception_typeof
  28:     0x7ffd11d7f541 - _CxxFrameHandler3
  29:     0x7ffd175928bf - _chkstk
  30:     0x7ffd17542554 - RtlRaiseException
  31:     0x7ffd175422a7 - RtlRaiseException
  32:     0x7ffd1511b699 - RaiseException
  33:     0x7ffce1db9b97 - _CxxThrowException
                               at D:\a\_work\1\s\src\vctools\crt\vcruntime\src\eh\throw.cpp:81
  34:     0x7ffce1d7f7a0 - panic_unwind::imp::panic
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/panic_unwind\src\seh.rs:352
  35:     0x7ffce1d7f7a0 - panic_unwind::__rust_start_panic
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/panic_unwind\src\lib.rs:97
  36:     0x7ffce1d68be5 - std::panicking::rust_panic
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\panicking.rs:862
  37:     0x7ffce1d6893b - std::panicking::rust_panic_with_hook
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\panicking.rs:826
  38:     0x7ffce1d68749 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\panicking.rs:674
  39:     0x7ffce1d65f6f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\sys\backtrace.rs:170
  40:     0x7ffce1d6834e - std::panicking::begin_panic_handler
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\panicking.rs:665
  41:     0x7ffce1dc8111 - core::panicking::panic_fmt
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/core\src\panicking.rs:75
  42:     0x7ffca0f4035c - wgpu::api::buffer::check_buffer_bounds
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-23.0.1\src\api\buffer.rs:684
  43:     0x7ff7d1277c3e - bevy_render::render_resource::buffer::Buffer::slice
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\render_resource\buffer.rs:37
  44:     0x7ff7d1277c3e - transform_gizmo_bevy::render::impl$5::render
                               at C:\Users\Barrett\.cargo\git\checkouts\transform-gizmo-47be3edc701ec198\0f6beb3\crates\transform-gizmo-bevy\src\render.rs:195
  45:     0x7ff7d1277c3e - bevy_render::render_phase::draw::impl$27::render
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\render_phase\draw.rs:255
  46:     0x7ff7d1277c3e - bevy_render::render_phase::draw::impl$4::draw<bevy_core_pipeline::core_3d::Transparent3d,tuple$<bevy_render::render_phase::SetItemPipeline,bevy_pbr::render::mesh::SetMeshViewBindGroup<0>,transform_gizmo_bevy::render::DrawTransformGizmo> >
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\render_phase\draw.rs:333
  47:     0x7ffca01ff48e - bevy_render::render_phase::SortedRenderPhase<bevy_core_pipeline::core_3d::Transparent3d>::render_range<bevy_core_pipeline::core_3d::Transparent3d,core::ops::range::RangeFull>
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\render_phase\mod.rs:813
  48:     0x7ffca03d3b7a - bevy_render::render_phase::SortedRenderPhase<bevy_core_pipeline::core_3d::Transparent3d>::render
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\render_phase\mod.rs:785
  49:     0x7ffca03d3b7a - bevy_core_pipeline::core_3d::main_transparent_pass_3d_node::impl$0::run
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_core_pipeline-0.15.0\src\core_3d\main_transparent_pass_3d_node.rs:74
  50:     0x7ffca02f83c9 - bevy_render::render_graph::node::impl$8::run<bevy_core_pipeline::core_3d::main_transparent_pass_3d_node::MainTransparentPass3dNode>
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\render_graph\node.rs:414
  51:     0x7ffca0647a5e - bevy_render::renderer::graph_runner::RenderGraphRunner::run_graph
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\renderer\graph_runner.rs:225
  52:     0x7ffca0647b94 - bevy_render::renderer::graph_runner::RenderGraphRunner::run_graph
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\renderer\graph_runner.rs:232
  53:     0x7ffca064654c - bevy_render::renderer::graph_runner::RenderGraphRunner::run<bevy_render::renderer::render_system::closure_env$1>
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\renderer\graph_runner.rs:80
  54:     0x7ffca0576fc1 - bevy_render::renderer::render_system
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_render-0.15.0\src\renderer\mod.rs:40
  55:     0x7ffca0592c7c - core::ops::function::FnMut::call_mut
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:166
  56:     0x7ffca0592c7c - core::ops::function::impls::impl$3::call_mut
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:294
  57:     0x7ffca0592c7c - bevy_ecs::system::exclusive_function_system::impl$5::run::call_inner
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.15.0\src\system\exclusive_function_system.rs:245
  58:     0x7ffca0592c7c - bevy_ecs::system::exclusive_function_system::impl$5::run
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.15.0\src\system\exclusive_function_system.rs:248
  59:     0x7ffca0592c7c - bevy_ecs::system::exclusive_function_system::impl$2::run::closure$0
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.15.0\src\system\exclusive_function_system.rs:129
  60:     0x7ffca0592c7c - bevy_ecs::world::World::last_change_tick_scope
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.15.0\src\world\mod.rs:3187
  61:     0x7ffca0592c7c - bevy_ecs::system::exclusive_function_system::impl$2::run<void (*)(ref_mut$<bevy_ecs::system::function_system::SystemState<bevy_ecs::system::query::Query<bevy_ecs::entity::Entity,bevy_ecs::query::filter::With<bevy_render::view::ViewTarget> > > >),void (*)(r
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.15.0\src\system\exclusive_function_system.rs:121
  62:     0x7ffca155881d - core::hint::black_box
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\hint.rs:389
  63:     0x7ffca155881d - bevy_ecs::schedule::executor::__rust_begin_short_backtrace::run
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.15.0\src\schedule\executor\mod.rs:170
  64:     0x7ffca1536249 - bevy_ecs::schedule::executor::multi_threaded::impl$5::spawn_exclusive_system_task::async_block$1::closure$0
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.15.0\src\schedule\executor\multi_threaded.rs:653
  65:     0x7ffca1536249 - core::ops::function::FnOnce::call_once
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:250
  66:     0x7ffca1536249 - core::panic::unwind_safe::impl$25::call_once
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\panic\unwind_safe.rs:272
  67:     0x7ffca1536249 - std::panicking::try::do_call
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:557
  68:     0x7ffca1536249 - std::panicking::try
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:520
  69:     0x7ffca1536249 - std::panic::catch_unwind
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panic.rs:358
  70:     0x7ffca1536249 - bevy_ecs::schedule::executor::multi_threaded::impl$5::spawn_exclusive_system_task::async_block$1
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.15.0\src\schedule\executor\multi_threaded.rs:652
  71:     0x7ffca1536249 - core::panic::unwind_safe::impl$28::poll
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\panic\unwind_safe.rs:297
  72:     0x7ffca1536249 - futures_lite::future::impl$11::poll::closure$0
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-lite-2.5.0\src\future.rs:656
  73:     0x7ffca1536249 - core::panic::unwind_safe::impl$25::call_once
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\panic\unwind_safe.rs:272
  74:     0x7ffca1536249 - std::panicking::try::do_call
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:557
  75:     0x7ffca1536249 - std::panicking::try
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:520
  76:     0x7ffca1536249 - std::panic::catch_unwind
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panic.rs:358
  77:     0x7ffca1536249 - futures_lite::future::impl$11::poll<core::panic::unwind_safe::AssertUnwindSafe<enum2$<bevy_ecs::schedule::executor::multi_threaded::impl$5::spawn_exclusive_system_task::async_block_env$1> > >
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-lite-2.5.0\src\future.rs:656
  78:     0x7ffca28e1cee - async_executor::impl$5::spawn_inner::async_block$0<enum2$<core::result::Result<tuple$<>,alloc::boxed::Box<dyn$<core::any::Any,core::marker::Send>,alloc::alloc::Global> > >,futures_lite::future::CatchUnwind<core::panic::unwind_safe::AssertUnwindSafe<enum2$<
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\async-executor-1.13.1\src\lib.rs:250
  79:     0x7ffca28dec6f - async_task::raw::impl$3::run::closure$1
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\async-task-4.7.1\src\raw.rs:550
  80:     0x7ffca28dec6f - core::ops::function::FnOnce::call_once
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:250
  81:     0x7ffca28dec6f - core::panic::unwind_safe::impl$25::call_once
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\panic\unwind_safe.rs:272
  82:     0x7ffca28dec6f - std::panicking::try::do_call
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:557
  83:     0x7ffca28dec6f - std::panicking::try
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panicking.rs:520
  84:     0x7ffca28dec6f - std::panic::catch_unwind
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\panic.rs:358
  85:     0x7ffca28dec6f - async_task::raw::RawTask<enum2$<async_executor::impl$5::spawn_inner::async_block_env$0<enum2$<core::result::Result<tuple$<>,alloc::boxed::Box<dyn$<core::any::Any,core::marker::Send>,alloc::alloc::Global> > >,futures_lite::future::CatchUnwind<core::panic::u
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\async-task-4.7.1\src\raw.rs:549
  86:     0x7ffca152d804 - async_task::runnable::Runnable<tuple$<> >::run
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\async-task-4.7.1\src\runnable.rs:781
  87:     0x7ffca152d804 - async_executor::impl$13::tick::async_fn$0
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\async-executor-1.13.1\src\lib.rs:729
  88:     0x7ffca152d804 - async_executor::impl$5::tick::async_fn$0
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\async-executor-1.13.1\src\lib.rs:325
  89:     0x7ffca152d804 - bevy_tasks::thread_executor::impl$2::tick::async_fn$0
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_tasks-0.15.0\src\thread_executor.rs:103
  90:     0x7ffca153010c - bevy_tasks::task_pool::TaskPool::scope_with_executor_inner
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_tasks-0.15.0\src\task_pool.rs:381
  91:     0x7ffca153010c - bevy_tasks::task_pool::impl$2::scope_with_executor::closure$0
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_tasks-0.15.0\src\task_pool.rs:0
  92:     0x7ffca153010c - std::thread::local::LocalKey<alloc::sync::Arc<bevy_tasks::thread_executor::ThreadExecutor,alloc::alloc::Global> >::try_with
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\local.rs:283
  93:     0x7ffca153010c - std::thread::local::LocalKey<alloc::sync::Arc<bevy_tasks::thread_executor::ThreadExecutor,alloc::alloc::Global> >::with
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\thread\local.rs:260
  94:     0x7ffca153010c - bevy_tasks::task_pool::TaskPool::scope_with_executor<bevy_ecs::schedule::executor::multi_threaded::impl$2::run::closure_env$1,tuple$<> >
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_tasks-0.15.0\src\task_pool.rs:307
  95:     0x7ffca15016eb - bevy_ecs::schedule::executor::multi_threaded::impl$2::run
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.15.0\src\schedule\executor\multi_threaded.rs:221
  96:     0x7ffca28d5376 - bevy_ecs::world::World::schedule_scope<tuple$<>,bevy_ecs::intern::Interned<dyn$<bevy_ecs::schedule::set::ScheduleLabel> >,bevy_ecs::world::impl$4::run_schedule::closure_env$0<bevy_ecs::intern::Interned<dyn$<bevy_ecs::schedule::set::ScheduleLabel> > > >
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_ecs-0.15.0\src\world\mod.rs:3705
  97:     0x7ffca14d2ffa - bevy_app::sub_app::SubApp::update
                               at C:\Users\Barrett\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bevy_app-0.15.0\src\sub_app.rs:142
  98:     0x7ffca08c4c9b - std::sys::backtrace::__rust_begin_short_backtrace<bevy_render::pipelined_rendering::impl$2::cleanup::closure_env$0,tuple$<> >
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\std\src\sys\backtrace.rs:154
  99:     0x7ffca06ab6d5 - core::ops::function::FnOnce::call_once<std::thread::impl$0::spawn_unchecked_::closure_env$1<bevy_render::pipelined_rendering::impl$2::cleanup::closure_env$0,tuple$<> >,tuple$<> >
                               at C:\Users\Barrett\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\library\core\src\ops\function.rs:250
 100:     0x7ffce1d7a3dd - alloc::boxed::impl$28::call_once
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/alloc\src\boxed.rs:1967
 101:     0x7ffce1d7a3dd - alloc::boxed::impl$28::call_once
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/alloc\src\boxed.rs:1967
 102:     0x7ffce1d7a3dd - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/705cfe0e966399e061d64dd3661bfbc57553ed87\library/std\src\sys\pal\windows\thread.rs:55
 103:     0x7ffd16617374 - BaseThreadInitThunk
 104:     0x7ffd1753cc91 - RtlUserThreadStart
error: process didn't exit successfully: `target\debug\recall_destruction_demo.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN)

Barrett@DESKTOP-H0N0G0O MINGW64 ~/Documents/projects/recall_destruction_demo (main)
$

I am using a very lightly modified version of the crate to make it compile. It only changes the transform-gizmo-bevy dependency from patch to git: https://github.com/onkoe/bevy_editor_pls

@ActuallyHappening
Copy link
Contributor Author

Yeah OK so this line seems to be the culprit, idk why and can't reproduce this bug so can't really help sorry 🤷

pass.set_index_buffer(gizmo.index_buffer.slice(..), 0, IndexFormat::Uint32);

@ethereumdegen ethereumdegen mentioned this pull request Dec 17, 2024
@ethereumdegen
Copy link

ethereumdegen commented Dec 18, 2024

i was able to fix the bug !! here is how . thanks for the tip actuallyhappening

impl<P: PhaseItem> RenderCommand<P> for DrawTransformGizmo {
    type ViewQuery = ();
    type ItemQuery = Read<GizmoDrawDataHandle>;
    type Param = SRes<RenderAssets<GizmoBuffers>>;

    #[inline]
    fn render<'w>(
        _item: &P,
        _view: ROQueryItem<'w, Self::ViewQuery>,
        handle: Option<ROQueryItem<'w, Self::ItemQuery>>,
        gizmos: SystemParamItem<'w, '_, Self::Param>,
        pass: &mut TrackedRenderPass<'w>,
    ) -> RenderCommandResult {
        let Some(handle) = handle else {
            return RenderCommandResult::Failure("No GizmoDrawDataHandle component found");
        };

        let Some(gizmo) = gizmos.into_inner().get(handle) else {
            return RenderCommandResult::Failure("No GizmoDrawDataHandle inner found");
        };

        //THIS FIXES MY CRASHING BUG FOR SOME REASON - PLEASE INVESTIGATE 
       if gizmo.index_buffer.size() == 0 {
        return RenderCommandResult::Failure("gizmo.index_buffer empty");
       }

       println!(" gizmo.index_buffer.size {}",  gizmo.index_buffer.size() );

        pass.set_index_buffer(gizmo.index_buffer.slice(..), 0, IndexFormat::Uint32);
        pass.set_vertex_buffer(0, gizmo.position_buffer.slice(..));
        pass.set_vertex_buffer(1, gizmo.color_buffer.slice(..));

        pass.draw_indexed(0..gizmo.index_count, 0, 0..1);

        RenderCommandResult::Success
    }
}

#[deriv

SO basically it seems like however i am integrating the gizmo, when i deselect it, the gizmo component gets into a state where it exists but it also has an empty index buffer. I am not sure why but anyways the code above makes it much safer ^

@ActuallyHappening
Copy link
Contributor Author

SO basically it seems like however i am integrating the gizmo, when i deselect it, the gizmo component gets into a state where it exists but it also has an empty index buffer. I am not sure why

I remember thinking to myself that problem may surface with the way bevy_editor_pls integrates with transform_gizmo_bevy, I used some hacky method and a bunch of safety checks of the form

if let Some(thing) = source.get() {
    // safe here
}

instead of manual length checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants